package month1;

public class MaximumDepthOfBinaryTree104_05 {
    public static void main(String[] args) {
        System.out.println(maxDepth(new TreeNode(new Integer[]{3, 9, 20, null, null, 15, 7})));
    }

    /**
     * 递归求值
     *
     * @param root
     * @return
     */
    static int maxDepth(TreeNode root) {
        return root == null ? 0 : Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }
}
